import { DataTypes } from 'sequelize';

export default function initServiceStaffModel(sequelize) {
  const ServiceStaff = sequelize.define('ServiceStaff', {
    id: {
      type: DataTypes.INTEGER,
      primaryKey: true,
      autoIncrement: true
    },
    nickname: {
      type: DataTypes.STRING(50),
      allowNull: false,
      comment: '客服昵称'
    },
    phone: {
      type: DataTypes.STRING(20),
      allowNull: true,
      comment: '联系电话'
    },
    email: {
      type: DataTypes.STRING(50),
      allowNull: true,
      comment: '联系邮箱'
    },
    userId: {
      type: DataTypes.INTEGER,
      allowNull: true,
      comment: '关联的用户ID'
    },
    type: {
      type: DataTypes.ENUM('platform_admin', 'community_admin', 'community_service'),
      allowNull: false,
      comment: '客服类型：平台管理员、社区管理员、社区客服'
    },
    status: {
      type: DataTypes.ENUM('active', 'inactive'),
      defaultValue: 'active',
      comment: '状态：活跃、非活跃'
    },
    avatar: {
      type: DataTypes.STRING(255),
      defaultValue: 'default-service-avatar.png',
      comment: '头像'
    },
    description: {
      type: DataTypes.STRING(500),
      allowNull: true,
      comment: '描述信息'
    }
  }, {
    tableName: 'service_staffs',
    timestamps: true
  });

  return ServiceStaff;
}
